package com.linsen.erp.admin.provider.enums;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.HashMap;
import java.util.Map;

//App登录范围
@Getter
@AllArgsConstructor
public enum AppScopeEnum {
    MANAGER(1,"管理端"),
    EMPLOYEE(2,"员工端"),
    ;

    @JsonValue
    private final Integer value;
    private final String desc;

    private static final Map<Integer, AppScopeEnum> VALUES = new HashMap<>();

    static {
        for (final AppScopeEnum appScopeEnum : AppScopeEnum.values()) {
            AppScopeEnum.VALUES.put(appScopeEnum.getValue(), appScopeEnum);
        }
    }

    @JsonCreator
    public static AppScopeEnum getByValue(Integer value) {
        return AppScopeEnum.VALUES.get(value);
    }
}
